package cn.zhagzheguo.xk.util;

import cn.zhagzheguo.xk.model.Course;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class JsonUtil {

	/**
	 * 将对象转化为 Json String
	 * 
	 * @param o
	 * @return
	 */
	public static String parse(Object o) {
		Gson gson = new GsonBuilder().serializeNulls().setPrettyPrinting().create();
		return gson.toJson(o);
	}

	public static void main(String[] args) {
		Course c = new Course();
		String json = JsonUtil.parse(c);

		System.out.println(json);
	}

}
